package com.ars.common.servlet.Login;

import com.ars.common.beans.User.User;
import com.ars.common.dao.check;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import java.sql.SQLException;

@WebServlet("/CheckLogUser")
public class checkLogUser extends HttpServlet {

    protected void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, java.io.IOException
    {
        String password = request.getParameter("password");
        String UserID = request.getParameter("UserID");

        User user = new User();
        user.setUserID(UserID);
        user.setPassword(password);

        //实现数据库查询用户
        check check = new check();
        try {
            if (check.checkUser(UserID, password)) {//查询到用户

                response.getWriter().write("success");

            } else {
                response.getWriter().write("error");
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } finally {

        }
    }
}
